/* $Id: proto.h,v 1.54 2007/03/18 10:43:04 sby Exp $ */

#ifndef _PROTO_H_
#define _PROTO_H_

/* others */
char *tparm(const char *str, ...);
int tgetent(const char *bp, char *name);
int tgetflag(const char *id);
int tgetnum(const char *id);
char *tgoto(const char *cap, int col, int row);
int tputs(const char *str, int affcnt, int (*putc)(int));
/* announce.c */
char *nextfield(register char *data, register char *field);
void load_paste(void);
void a_copyitem(char *fpath, char *title, char *owner);
int a_menu(const char * const maintitle, char *path, int lastlevel, int mode);
int Announce(void);
int Log(void);
int XFile(void);
int HELP(void);
int user_gem(char *uid);
int user_allpost(char *uid);
/* bbs.c */
void log_board3(char *mode, const char *str, int num);
void make_blist(void);
int set_board(void);
void doent(int num, fileheader *ent, int, char *);
int cmpbnames(const char *bname, void *brec);
int cmpfilename(fileheader *fhdr);
int cmpfmode(fileheader *fhdr);
int cmpfowner(fileheader *fhdr);
void do_reply_title(int row, char *title);
int getindex(char *fpath, char *fname, int size);
int do_post(void);
int edit_post(int ent, fileheader *fhdr, char *direct);
int cross_post(int ent, fileheader *fhdr, char *direct);
int man(void);
int cite(int ent, fileheader *fhdr, char *direct);
int Cite_post(int ent, fileheader *fhdr, char *direct);
int Cite_posts(int ent, fileheader *fhdr, char *direct);
int add_tag(int ent, fileheader *fhdr, char *direct);
int del_tag(int ent, fileheader *fhdr, char *direct);
int gem_tag(int ent, fileheader *fhdr, char *direct);
int mark(int ent, fileheader *fhdr, char *direct);
int del_range(int ent, fileheader *fhdr, char *direct);
int save_mail(int ent, fileheader *fh, char *direct);
int board_select(void);
int board_digest(void);
void Read(void);
void ReadSelect(void);
void m_read(void);
int my_gem(void);
int my_allpost(void);
void bookmark(const struct bookmarks *booklist, const int def);
int Goodbye(void);
/* brc.c */
int brc_initialize();
void brc_finalize();
int brc_initial_board(const char *boardname);
time4_t * brc_find_record(int bid, int *num);
void brc_update(void);
void brc_addlist(const char *fname);
int brc_unread_time(time4_t ftime, int bnum, const time4_t *blist);
int brc_unread(const char *fname, int bnum, const time4_t *blist);
void brc_trunc(int bid, time4_t ftime);
/* board.c */
void init_brdbuf(void);
int check_newpost(boardstat *ptr);
void nusers_printer(int bid);
void choose_board(int newflag, usint mode);
int Ben_Perm(boardheader *bptr);
int board(void);
int tw_board(void);
int local_board(void);
int good_board(void);
int hotboard(void);
int New(void);
void force_board(char *bname);
void voteboard(void);
/* cache.c */
void attach_SHM(void);
unsigned int safe_sleep(unsigned int seconds);
void reload_ucache(void);
void resolve_ucache(void);
int searchuser(char *userid);
int getuser(char *userid);
char *getuserid(int num);
void setuserid(const int num, const char * const userid);
int searchnewuser(const int mode);
char *u_namearray(char buf[][12  + 1], int *pnum, char *tag);
void setutmpmode(const usint mode);
void resetutmpent(void);
void getnewutmpent(user_info *up);
user_info *search_ulist(int (*fptr)(int, user_info *), int farg);
int count_multi(void);
user_info *search_ulistn(int (*fptr)(int, user_info *), int farg, int unum);
void purge_utmp(user_info *uentp);
int count_ulist(void);
void touch_boards(void);
void reload_bcache(void);
void resolve_boards(void);
void setbbottom(const int bid);
int getbbottom(const int bid);
void touchbbottom(const int bid);
int getbtotal(const int bid);
void setbtotal(const int bid);
void touchdircache(const int bid);
int get_fileheader_cache(const int bid, const char *direct,
    fileheader *headers, const int recbase, const int nlines);
void touchbtotal(const int bid);
void hbflreload(const int bid);
int hbflcheck(const int bid, const int uid);
void ptreload(const int bid);
int getbnum_mode(const char *bname, const int mode);
int getbnum(const char *bname);
int apply_boards(int (*func)(void));
boardheader *getbcache(const char *bname);
int inbtotal(char *bname, int add);
char *getbname(const int bid);
int haspostperm(const char *bname);
int film_out(int tag, const int row);
void m2_out(const int tag, const int row);
void feast_init(void);
void reload_fcache(void);
void resolve_fcache(void);
user_info *searchowner(const char *userid);
/* edit.c */
void auto_backup(void);
void restore_backup(void);
void write_header(FILE *fp);
void addsignature(FILE *fp);
void edit_outs(char *text);
char *strcasestr(const char *big, const char *little);
int vedit(char *fpath, int saveheader, int *islocal);
/* visio.c */
void oflush(void);
int ochar(int c);
void do_move(int destcol, int destline);
void save_cursor(void);
void restore_cursor(void);
void initscr(void);
void move(int y, int x);
void getyx(int *y, int *x);
void redoscr(void);
void refresh(void);
void clear(void);
void clrtobot(void);
void clrtoeol(void);
void clrchyiuan(int x, int y);
void outch(int c);
void outc(int ch);
void outs(register const char *str);
void outmsg(register const char *msg);
void outz(register const char * const msg);
void prints(const char *fmt, ...);
void scroll(void);
void rscroll(void);
void region_scroll_up(int top, int bottom);
void standout(void);
void standend(void);
void vs_save(screenline *screen);
void vs_restore(screenline *screen);
void capture_screen(void);
void init_alarm(void);
void add_io(int fd, int timeout);
int igetch(void);
int getdata(int line, int col, const char * const prompt, char *buf, int len, int echo, char *ans);
char getans2(int line, int col, const char * const prompt, char * const *s, int many, const char def);
char getans(char *prompt);
char getans1(char *prompt);
int igetkey(void);
/* mail.c */
void hold_mail(char *fpath, char *receiver);
int do_m_read(void);
int chkmailbox(void);
int bbs_sendmail(char *fpath, char *title, char *receiver, char *key);
int chkmail(int rechk);
int mail_reply(int ent, fileheader *fhdr, char *direct);
int multi_reply(int ent, fileheader *fhdr, char *direct);
int m_forward(int ent, fileheader *fhdr, char *direct);
void multi_send(char *title, int inmail);
int do_send(char *userid, char *title);
/* main.c */
void log_usies(const char *mode, const char *msg);
void u_exit(const char *mode);
void abort_bbs(void);
int dosearchuser(char *userid);
void show_last_call_in(void);
void del_distinct(char *fname, char *line);
void setup_utmp(int mode);
/* menu.c */
int finance(void);
void showtitle(char *title, const char *mid);
void movie(void);
void domenu(int cmdmode, char *cmdtitle, int cmd, struct one_key *cmdtable);
int addmenu(void);
/* more.c */
char *Ptt_prints(char *str, int mode);
int more(char *fpath, int promptend);
/* name.c */
void CreateNameList(void);
void AddNameList(char *name);
int RemoveNameList(char *name);
int InNameList(char *name);
void ShowNameList(int row, int column, const char * const prompt);
int CountNameList(void);
void LoadNameList(int *reciper, const char * const listfile, const char * const msg);
void ToggleNameList(int *reciper, const char * const listfile, const char * const msg);
int chkstr(char *otag, char *tag, char *name);
struct word *AppearInList(struct word *cwlist, char *data);
void namecomplete(const char * const prompt, char *data);
void usercomplete(const char * const prompt, char *data);
void brdcomplete(const char * const prompt, char *data);
void idlist_add(char *fpath, char *desc, char *uident);
void idlist_delete(char *fpath, char *uident);
/* read.c */
int i_read_helper(struct one_key *rcmdlist);
keeploc *getkeep(char *s, int def_topline, int def_cursline);
int Tagger(time_t chrono, int recno, int mode);
int i_read(usint cmdmode, char *direct, void (*dotitle)(void), void (*doentry)(int, fileheader *, int, char *), struct one_key *rcmdlist, void (*dofoot)(void));
/* record.c */
int get_sum_records(const char * const fpath, int size);
int get_records(const char * const fpath, void *rptr, int size, int id, int number);
int substitute_record(const char * const fpath, void *rptr, int size, int id);
int rec_del(const char fpath[], int size, int id);
int delete_range(const char * const fpath, int id1, int id2);
int search_rec(const char * const dirname, int (*filecheck)(fileheader *));
int delete_files(char *dirname, int (*filecheck)(fileheader *));
int delete_file(const char * const dirname, int size, int ent, int (*filecheck)(fileheader *));
int rec_search(const char * const fpath, void *rptr, int size, int (*fptr)(const char *, void *), const char *farg);
void stampfile(char *fpath, fileheader *fh);
void stampdir(char *fpath, fileheader *fh);
void stamplink(char *fpath, fileheader *fh);
int gem_files(char *dirname, int (*filecheck)(fileheader *));
/* stuff.c */
int chyiuan_ansi(char *buf, char *str, const int max);
void setuserfile(char *buf, const char *fname);
void setbdir(char *buf, const char *boardname);
int invalid_fname(char *str);
int invalid_pname(char *str);
int valid_ident(char *ident);
int userid_is_BM(char *userid, char *list);
int is_BM(char *list);
off_t dashs(const char *fname);
long dasht(const char *fname);
int dashl(const char *fname);
int dashf(const char *fname);
int dashd(const char *fname);
int belong(const char *filelist, const char *key);
int belong_spam(const char *filelist, const char *key);
char *Cdatelite(const time_t *clock);
char *Cdate(time_t *clock);
void pressanykey(const char *fmt, ...);
void bell(void);
int search_num(int ch, int max);
void stand_title(const char *title);
void cursor_show(int row, int column);
void cursor_clear(int row, int column);
int cursor_key(int row, int column);
void printdash(const char *mesg);
void update_data(void);
int show_file(const char *filename, const int y, int lines, const int mode);
int answer(char *s);
void edit_note(void);
char *my_ctime(const time_t *t);
int check_personal_note(int newflag, char *userid);
void myth_show_help(void);
int mail2user(userec muser, const char *title, char *fname);
void debug(char *mode);
int lockutmpmode(const int unmode);
void unlockutmpmode(void);
unsigned int setperms(unsigned int pbits);
/* talk.c */
int cmpuids(int uid, user_info *urec);
const char *modestring(user_info *uentp, int simple);
int is_friend(user_info *ui);
int is_rejected(user_info *ui);
int my_query(char *uident);
int my_write(pid_t pid, char *hint);
void t_display_new(void);
int t_display(void);
int cmpuname(const char *userid, void *pal);
void aloha_add(char *id, PAL *pal);
void friend_load(void);
int t_users(void);
int t_pager(void);
int t_idle(void);
int t_query(void);
void talkreply(void);
/* list.c */
int belong_list(const char *fname, const char *userid);
int list_add(void);
int ListMain(void);
void ListEdit(usint cmdmode, char *fname);
int list_move(int ent, PAL *fhdr, char *direct);
/* favor.c */
void load_favor(FAVOR *fhdr, int top, int num);
int do_favor(void);
void favor_brd_add(char *brdname);
int my_favor(void);
/* user.c */
void user_display(userec *u, int real);
int u_cloak(void);
void uinfo_query(userec *u, int real, int unum);
int u_info(void);
int bad_user_id(char *userid);
void check_register(void);
int get_color(char *color, char cset[5]);
void get_lightbar_color(char *color);
int login_plan(void);
/* osdep.c */
void (*bsd_signal(int sig, void (*func)(int)))(int);
#endif
